import { ecs } from "db://oops-framework/libs/ecs/ECS";
import { Role } from "../../../role/Role";
import { ISkillReport } from "../../skill/model/report/ISkillReport";
import { Skill } from "../../skill/Skill";

/** 战场中的所有场景数据管理 */
@ecs.register('MapModelRole')
export class MapModelRoleComp extends ecs.Comp {
    /** 当前回合 */
    round: number = 1;
    /** 记录战场敌我双方角色信息 */
    roles: Role[] = [];
    /** 友军阵营 */
    friends: Role[] = [];
    /** 敌人 */
    enemys: Role[] = [];
    /** 战场动画数据 */
    reports: ISkillReport[] = [];
     current_skill: Skill = null!;

    /** 阵容是否改变，改变要重置战斗 */
    teamChange: Boolean = false;

    /** 数据层组件移除时，重置所有数据为默认值 */
    reset() {
        this.round = 1;
        this.teamChange = true;
        this.friends.forEach(r => {
            r.destroy();
        });
        this.friends.splice(0, this.friends.length);

        this.enemys.forEach(r => {
            r.destroy();
        });
        this.enemys.splice(0, this.enemys.length);

       // this.reports.splice(0, this.reports.length);
    }
}